package com.tanhua.dubbo.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;

public enum SexEnum implements IEnum<Integer> {

    MAN(1, "男"),
    WOMAN(2, "女"),
    UNKNOWN(3, "未知");

    private int value;
    private String desc;

    SexEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getSexByValue(Integer value) {
        SexEnum[] sexEnums = values();
        for (SexEnum sexEnum : sexEnums) {
            if (sexEnum.value == value) {
                return sexEnum.desc;
            }
        }
        return null;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String toString() {
        return this.desc;
    }

}